<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>键盘事件中获取键盘上的值</title>
</head>
<body>
<script>
    window.onkeyup=function (ev){
        //当键盘按下时，获取对应的Unicode值
        var keyCode=ev.keyCode;
        console.log(keyCode)
        console.log(String.fromCharCode(keyCode));
        console.log(ev.key)
    }
</script>
</body>
</html>